﻿using System;

namespace Core.Library
{
    public class UrlHelpers
    {
        /***************************************
        = User Control System
        -------------------------------------- */

        // group
        /************************************************************************************************************************************************************/
        public static string ListGroup
        {
            get { return "/Default.aspx?cId=2"; }            
        }

        public static string CreateGroup
        {
            get { return "/Default.aspx?cId=2&ucId=edit"; }                        
        }

        public static string EditGroup(int id)
        {
            return string.Format("/Default.aspx?cId=2&ucId=edit&gId={0}", id);
        }        

        public static string AdminGroupMenu(int id)
        {
            return string.Format("/Default.aspx?cId=2&ucId=agm&gId={0}", id);
        }

        // user
        /************************************************************************************************************************************************************/
        public static string ListUser
        {
            get { return "/Default.aspx?cId=3"; }
        }

        public static string CreateUser
        {
            get { return "/Default.aspx?cId=3&ucId=edit"; }
        }
        public static string EditUser(int id)
        {
            return string.Format("/Default.aspx?cId=3&ucId=edit&uId={0}", id);
        }

        public static string UserChangePassword
        {
            get { return "/Default.aspx?cId=20"; }
        }

        public static string UserInformation
        {
            get { return "/Default.aspx?cId=19"; }
        }

        public static string ChangePassword(int id)
        {
            return string.Format("/Default.aspx?cId=3&ucId=cpw&uId={0}", id);
        }

        public static string AdminGroupUser(int id)
        {
            return string.Format("/Default.aspx?cId=3&ucId=agu&uId={0}", id);
        }

        // admin menu
        /************************************************************************************************************************************************************/
        public static string ListMenu
        {
            get { return "/Default.aspx?cId=4"; }
        }

        public static string CreateMenu
        {
            get { return "/Default.aspx?cId=4&ucId=edit"; }
        }

        public static string EditMenu(int menuId)
        {
            return string.Format("/Default.aspx?cId=4&mId={0}&ucId=edit", menuId);
        }

        public static string ListTab(int controlId, string tab)
        {
            return string.Format("/Default.aspx?cId={0}&tab={1}", controlId, tab);
        }

        public static string ListTabSpecial(int controlId, string tab)
        {
            return string.Format("/Default.aspx?cId={0}&tab={1}", controlId, tab);
        }

        /***************************************
        = User Control Site
        -------------------------------------- */

        // List All
        /************************************************************************************************************************************************************/

        /// <summary>
        /// Hehe Horo | Top Quizzer | Vip Quiz
        /// </summary>
        /// <param name="controlId">Id của control (AdminMenuId)</param>
        /// <param name="keyword">Từ khóa</param>
        /// <param name="tab">Tab</param>
        /// <param name="startDate">Ngày bắt đầu</param>
        /// <param name="endDate">Ngày kết thúc</param>
        /// <param name="pageIndex">Số trang</param>
        /// <param name="pageSize">Số lượng dòng</param>
        /// <returns></returns>
        public static string ListSearch(int controlId, string keyword, string tab, string startDate, string endDate, string pageIndex, int pageSize)
        {
            return string.Format("/Default.aspx?cId={0}&k={1}&tab={2}&sd={3}&ed={4}&pi={5}&ps={6}", controlId, keyword, tab, startDate, endDate, pageIndex, pageSize);
        }

        public static string ListSearch(int controlId, string kName, string kEmail, string tab, string pageIndex, int pageSize)
        {
            return string.Format("/Default.aspx?cId={0}&kname={1}&kemail={2}&tab={3}&pi={4}&ps={5}", controlId, kName, kEmail, tab, pageIndex, pageSize);
        }

        public static string ListSearchCompany(int controlId, string k, string pageIndex, int pageSize)
        {
            return string.Format("/Default.aspx?cId={0}&k={1}&pi={2}&ps={3}", controlId, k, pageIndex, pageSize);
        }

        public static string ListSearch(int controlId, string tab, string pageIdex, int pageSize)
        {
            return string.Format("/Default.aspx?cId={0}&tab={1}&pi={2}&ps={3}", controlId, tab, pageIdex, pageSize);
        }

        // Company
        /************************************************************************************************************************************************************/
        public static string EditCompany(string id, string rUrl)
        {
            return string.Format("/Default.aspx?cId=18&id={0}&action=edit&rUrl={1}", id, rUrl);
        }

        // News
        /************************************************************************************************************************************************************/
        public static string CreateNews(string rUrl)
        {
            return string.Format("/Default.aspx?cId=7&action=create&rUrl={0}", rUrl);
        }

        public static string EditNews(string id, string rUrl)
        {
            return string.Format("/Default.aspx?cId=7&id={0}&action=edit&rUrl={1}", id, rUrl);
        }

        // Members
        /************************************************************************************************************************************************************/

        public static string EditMembers(string id, string rUrl)
        {
            return string.Format("/Default.aspx?cId=11&id={0}&action=edit&rUrl={1}", id, rUrl);
        }

        // QA
        /************************************************************************************************************************************************************/
        public static string CreateQA(string rUrl)
        {
            return string.Format("/Default.aspx?cId=13&action=create&rUrl={0}", rUrl);
        }

        public static string EditQA(string id, string rUrl)
        {
            return string.Format("/Default.aspx?cId=13&id={0}&action=edit&rUrl={1}", id, rUrl);
        }

        // Tag
        /************************************************************************************************************************************************************/
        public static string CreateTag(string rUrl)
        {
            return string.Format("/Default.aspx?cId=9&action=create&rUrl={0}", rUrl);
        }

        public static string EditTag(string id, string rUrl)
        {
            return string.Format("/Default.aspx?cId=9&id={0}&action=edit&rUrl={1}", id, rUrl);
        }

        // company popup
        /************************************************************************************************************************************************************/
        public static string ListSearchPopup(int id, string keyword, string pageIndex, int pageSize)
        {
            return string.Format("/PopupListArticles.aspx?id={0}&k={1}&pi={2}&ps={3}", id, keyword, pageIndex, pageSize);
        }

        /***************************************
        = Front End
        -------------------------------------- */

        public static string NewsDetails(object id, object title)
        {
            return string.Format("{3}tin-tuc/{0}-{1}{2}", UnicodeUtility.UnicodeToKoDauAndGach(ConvertUtility.ConvertTo<string>(title)), id, Const.DOMAIN_EXTENSION, Const.SITE_URL);
        }

        public static string NewsDetailsSort(object id)
        {
            return string.Format("{2}tin-tuc/{0}{1}",  id, Const.DOMAIN_EXTENSION, Const.SITE_URL);
        }

        public static string MembersDetails(object id, object email, object round)
        {
            return string.Format("{2}trang-ca-nhan/vong-{3}/{0}-{4}{1}", Utils.CutEmail(email), Const.DOMAIN_EXTENSION, Const.SITE_URL, round, ConvertUtility.ConvertTo<string>(id));
        }

        public static string CompanyList(object fullname, object id)
        {
            return string.Format("{2}cong-ty/{0}-{1}{3}", UnicodeUtility.UnicodeToKoDauAndGach(ConvertUtility.ConvertTo<string>(fullname)), id, Const.SITE_URL, Const.DOMAIN_EXTENSION);
        }

        public static string CompanyList(object fullname, object id, object round)
        {
            return string.Format("{2}cong-ty/vong-{4}/{0}-{1}{3}", UnicodeUtility.UnicodeToKoDauAndGach(ConvertUtility.ConvertTo<string>(fullname)), id, Const.SITE_URL, Const.DOMAIN_EXTENSION, round);
        }
    }
}
